From 29d11da8c6ea72a41050bf39d7889a168ae6f5a2 Mon Sep 17 00:00:00 2001 From: Hidetoshi Tajima Date: Mon, 6 Aug 2001 17:09:26 +0000 Subject: [PATCH] Skip g_convert when to_codeset and from_codeset are both 'UTF-8' (gnome * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): Skip g_convert when to_codeset and from_codeset are both 'UTF-8' (gnome bugzilla #58202) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ modules/input/gtkimcontextxim.c | 31 +++++++++++++++++++------------ 8 files changed, 61 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d84578a1a2..63a5cf578d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2001-08-06 HideToshi Tajima + + * modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8): + Skip g_convert when to_codeset and from_codeset are both 'UTF-8' + (gnome bugzilla #58202) + 2001-08-06 Havoc Pennington * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index 2da314c81e..141d15f858 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -281,14 +281,18 @@ mb_to_utf8 (GtkIMContextXIM *context_xim, GError *error = NULL; gchar *result; - result = g_convert (str, -1, - "UTF-8", context_xim->mb_charset, - NULL, NULL, &error); - - if (!result) + if (strcmp (context_xim->mb_charset, "UTF-8") == 0) + result = g_strdup (str); + else { - g_warning ("Error converting text from IM to UTF-8: %s\n", error->message); - g_error_free (error); + result = g_convert (str, -1, + "UTF-8", context_xim->mb_charset, + NULL, NULL, &error); + if (!result) + { + g_warning ("Error converting text from IM to UTF-8: %s\n", error->message); + g_error_free (error); + } } return result; @@ -603,11 +607,14 @@ xim_text_to_utf8 (GtkIMContextXIM *context, XIMText *xim_text, gchar **text) return 0; } - result = g_convert (xim_text->string.multi_byte, - -1, - "UTF-8", - context->mb_charset, - NULL, NULL, &error); + if (strcmp (context->mb_charset, "UTF-8") == 0) + result = g_strdup (xim_text->string.multi_byte); + else + result = g_convert (xim_text->string.multi_byte, + -1, + "UTF-8", + context->mb_charset, + NULL, NULL, &error); if (result) { -- 2.30.2